package com.eos.control.action.ajax;

import java.util.List;

import com.eos.business.service.SysProductBusinessService;
import com.eos.common.tool.ConstantTool;
import com.eos.common.tool.ObjectUtils;
import com.eos.control.action.base.AbstractBaseAction;
import com.eos.orm.mybatis.model.ProductModel;

public class GetProductModelAjax extends AbstractBaseAction {
	private static final long serialVersionUID = 8674293317570373164L;
	private Integer brandId;
	private String result;
	
	public void setBrandId(Integer brandId) {
		this.brandId = brandId;
	}

	public String getResult() {
		return result;
	}

	@Override
	public String execute() {
		try{
			SysProductBusinessService spbs = new SysProductBusinessService();
			ProductModel pm = new ProductModel();
			pm.setDealFlag(ConstantTool.DEAL_FALG_OK);
			pm.setStatus(ConstantTool.STATUS_OK);
			pm.setBrandId(brandId);
			List<ProductModel> pmList = spbs.getProductModelExample(pm);
			result = ObjectUtils.listToJson(pmList);
		}catch (Exception e) {
			e.printStackTrace();
			result = "";
		}
		return SUCCESS;
	}
}
